package com.java_senior_2;

import java.util.Objects;

public class Employee {
    private int id;
    private String name;
    private int age;
    private double salary;

    public Employee(int id, String name, int age, double salary) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public Employee() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
    public void print(){
        System.out.println(getId()+getName()+getAge()+"工资"+getSalary());
    }

    public void work(){
        System.out.println("我在工作");
    }

    @Override
    public boolean equals(Object o) {
    if (!(o instanceof Employee)){
       return false;
    }
        Employee employee=(Employee)o;
      if ( employee.getId()==this.getId()&&employee.getName().equals(this.getName())){
          return true;
      }else {
          return false;
      }

    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name);
    }
}
